import { request } from './index'

// 购物车数量以及产品信息
export function CartList (data?: string) {
  return request({
    url: `/api/carts?${data}`,
    method: 'get'
  })
}

// 修改单个产品数量
export function UpdateNum (id: string, data: {num: string}) {
  return request({
    url: `/api/carts/${id}`,
    method: 'put',
    data: data
  })
}

// 删除产品
export function DeleteProduct (id: number) {
  return request({
    url: `/api/carts/${id}`,
    method: 'delete'
  })
}

export function checkedCart (data: {cart_ids: any}) { // 选中商品
  return request({
      url: '/api/carts/checked',
      method: 'patch',
      data: data
  })
}